﻿using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace YaoYunDong
{
    // 注意: 有关启用 IIS6 或 IIS7 经典模式的说明，
    // 请访问 http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });

            routes.MapRoute(
                "Register",
                "Register.html",
                new { controller = "Home", action = "Register" }
                );

            routes.MapRoute(
                "Channel",
                "{ChannelCode}",
                new { controller = "Channel", action = "Index", ChannelCode = "" }
                );

            routes.MapRoute(
                "ChannelActivity",
                "{ChannelCode}/ActivityList-{PageNo}.html",
                new { controller = "Channel", action = "ActivityList", ChannelCode = "", PageNo = 1 }
                );

            routes.MapRoute(
                "Group",
                "Group/{Code}",
                new { controller = "Group", action = "Index", Code = "" }
                );

            routes.MapRoute(
                "UploadPhoto",
                "Group/{Code}/UploadPhoto.html",
                new { controller = "Group", action = "UploadPhoto", Code = "" }
                );

            routes.MapRoute(
                "CreateGroup",
                "Group/{Code}/CreateGroup.html",
                new { controller = "Group", action = "CreateGroup", Code = "" }
                );

            routes.MapRoute(
                "GroupTopics",
                "Group/{Code}/Topics.html",
                new { controller = "Group", action = "Topics", Code = "" }
                );

            routes.MapRoute(
                "TopicDetails",
                "Topic/{id}.html",
                new { controller = "Topics", action = "Details", id = UrlParameter.Optional }
                );

            routes.MapRoute(
                "CreateGroupActivity",
                "Group/{Code}/CreateActivity.html",
                new { controller = "Group", action = "CreateActivity", Code = "" }
                );

            routes.MapRoute(
                "CreateGroupActivityStep1",
                "Group/{Code}/CreateActivity/Step1.html",
                new { controller = "Activity", action = "CreateActivity", Code = "" }
                );

            routes.MapRoute(
                "Default",
                "{controller}/{action}/{id}",
                new { controller = "Home", action = "Index", id = UrlParameter.Optional }
                );
        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);
        }
    }
}